home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970326-19970626 / 000336_news@newsmaster….columbia.edu _Fri Jun 20 23:14:53 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  6KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id XAA16342
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Fri, 20 Jun 1997 23:14:52 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id XAA02486
  7.     for kermit.misc@watsun; Fri, 20 Jun 1997 23:14:52 -0400 (EDT)
  8. Newsgroups: comp.protocols.kermit.misc
  9. Subject: Re: ShellExecute()
  10. Message-ID: <33aa9b09.2490401@news.opus1.com>
  11. From: hatcher@flash.net (Erik Hatcher)
  12. Date: Fri, 20 Jun 1997 15:04:07 GMT
  13. Reply-To: hatcher@flash.net
  14. References: <33a9fbb4.471671067@news.rochester.ican.net>
  15. Nntp-Posting-Host: ip011.pvsoftware.com
  16. X-Newsreader: Forte Free Agent 1.1/32.230
  17. Lines: 146
  18. Path: news.columbia.edu!panix!howland.erols.net!news.maxwell.syr.edu!news.he.net!gridnntp1!summer.Opus1.COM!opus1.com!opus1.com!nntp
  19. Xref: news.columbia.edu comp.protocols.kermit.misc:7198
  20.  
  21. Why re-invent the wheel folks???
  22.  
  23. Win95 and WinNT 4.0 both have a way of doing this without writing a
  24. new program.  Its the "start" command.
  25.  
  26. I tried it by using "start http://www.pvsoftware.com" and it
  27. worked by opening that page in the *already* opened browser (IE 3).
  28.  
  29. Here's the output of "start /?"...
  30.  
  31. Starts a separate window to run a specified program or command.
  32.  
  33. START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
  34.       [/LOW | /NORMAL | /HIGH | /REALTIME] [/WAIT] [/B]
  35. [command/program] [parameters]
  36.  
  37.     "title"     Title to display in  window title bar.
  38.     path        Starting directory
  39.     I           The new environment will be the original environment
  40. passed
  41.                 to the cmd.exe and not the current environment.
  42.     MIN         Start window minimized
  43.     MAX         Start window maximized
  44.     SEPARATE    Start 16-bit Windows program in separate memory space
  45.     SHARED      Start 16-bit Windows program in shared memory space
  46.     LOW         Start application in the IDLE priority class
  47.     NORMAL      Start application in the NORMAL priority class
  48.     HIGH        Start application in the HIGH priority class
  49.     REALTIME    Start application in the REALTIME priority class
  50.     WAIT        Start application and wait for it to terminate
  51.     B           Start application without creating a new window. The
  52.                 application has ^C handling ignored. Unless the
  53. application
  54.                 enables ^C processing, ^Break is the only way to
  55. interrupt the
  56.                 application
  57.     command/program
  58.                 If it is an internal cmd command or a batch file then
  59.                 the command processor is run with the /K switch to
  60. cmd.exe.
  61.                 This means that the window will remain after the
  62. command
  63.                 has been run.
  64.  
  65.                 If it is not an internal cmd command or batch file
  66. then
  67.                 it is a program and will run as either a windowed
  68. application
  69.                 or a console application.
  70.  
  71.     parameters  These are the parameters passed to the command/program
  72.  
  73.  
  74. If Command Extensions are enabled, external command invocation
  75. through the command line or the START command changes as follows:
  76.  
  77. non-executable files may be invoked through their file association
  78. just
  79.     by typing the name of the file as a command.  (e.g.  WORD.DOC
  80. would
  81.     launch the application associated with the .DOC file extension).
  82.     See the ASSOC and FTYPE commands for how to create these
  83.     associations from within a command script.
  84.  
  85. When executing an application that is a 32-bit GUI application,
  86. CMD.EXE
  87.     does not wait for the application to terminate before returning to
  88.     the command prompt.  This new behavior does NOT occur if executing
  89.     within a command script.
  90.  
  91. When executing a command line whose first token is CMD without an
  92.     extension or path qualifier, then replaces CMD with the value of
  93. the
  94.     COMSPEC variable, thus avoiding picking up random versions of
  95.     CMD.EXE when you least expect them.
  96.  
  97. When executing a command line whose first token does NOT contain an
  98.     extension, then CMD.EXE uses the value of the PATHEXT
  99.     environment variable to determine which extensions to look for
  100.     and in what order.  The default value for the PATHEXT variable
  101.     is:
  102.  
  103.         .COM;.EXE;.BAT;.CMD
  104.  
  105.     Notice the syntax is the same as the PATH variable, with
  106.     semicolons separating the different elements.
  107.  
  108. When executing a command, if there is no match on any extension, then
  109. looks to see if the name, without any extension, matches a directory
  110. name
  111. and if it does, the START command launches the Explorer on that path.
  112. If done from the command line, it is the equivalent to doing a CD /D
  113. to that path.
  114.  
  115.  
  116. On Fri, 20 Jun 1997 05:01:46 GMT, vefatica@syr.edu (Vincent Fatica)
  117. wrote:
  118.  
  119. >OK ... so I built this useful little one-liner (on NT 4.0 with
  120. >MSVC++4.0) ...
  121. >
  122. >//SE.CPP
  123. >#include <windows.h>
  124. >HINSTANCE main ( int argc, char * argv[] )
  125. >{return ShellExecute(NULL, "open", argv[1], 
  126. >    (argc > 2) ? argv[2] : NULL, 
  127. >    (argc > 3) ? argv[3] : NULL, 
  128. >    SW_SHOW);
  129. >}
  130. >
  131. >syntax:  SE [shell_object] [parameters [working dir]]  
  132. >
  133. >(Empty and multiword "parameters" must be "quoted"; likewise
  134. >path\program names containing spaces.)
  135. >
  136. >It can be used as K95's browser (tried it). Also, if you invoke SE
  137. >from the K95 command line (with "run"), since SE itself exits, you can
  138. >return to the K95 prompt while the browser (or whatever) is still
  139. >running. It works here (on NT); no promises intended.
  140. >
  141. >Command line examples:
  142. >
  143. >    se http://www.kermit.columbia    (netscape, (here))
  144. >    se c:                (explorer)
  145. >    se c:\winnt            (explorer)
  146. >    se CMD "" c:\winnt        (CMD session)
  147. >    se CMD "/c file.bat"        (run bat & quit)
  148. >    se mailto:vefatica@syr.edu    (pmail, (here))
  149. >    se file.txt            (notepad)
  150. >    se file.doc            (word, (here))
  151. >    se ftp://kermit.columbia.edu    (netscape)
  152. >    se CMD "/k dir /s /p" h:\k95\    (run dir & stay)
  153. >    se     (starts explorer in root/boot dir (here anyway))
  154. >
  155. >SE should start anything the shell knows how to handle, otherwise,
  156. >fail and return 0. Anyone is welcomed to it. Get it (15872 bytes) at:
  157. >
  158. >    ftp://math.syr.edu/pub/vefatica/se.exe
  159. >
  160. > - Vince
  161. >___
  162. >   Vincent Fatica
  163. >   Syracuse University Mathematics
  164. >   vefatica@syr.edu
  165. >   http://barnyard.syr.edu/~vefatica/
  166.